def get_zcy(n:int) -> int:
str_n = str(n)
res = str_n + str_n[::-1]
return int(res)
def main():
res = 0
inp = input().split()
k = int(inp[0])
p = int(inp[1])
s = 0
for i in range(1, k + 1):
s += get_zcy(i)
print(s % p)
if __name__ == "__main__":
main()
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int b[1000005];
void run_case(){
int n,k;
cin >> n>> k;
int j=1;
ll sum=0;
while(n-->0)
{
string s=to_string(j);
string t=s;
reverse(t.begin(), t.end());
sum=sum+stoll(s+t);
j++;
}
cout << sum%k << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll tests=1;
//cin >> tests;
while (tests-- > 0)
run_case();
}
190D - Non-Secret Cypher | 1721B - Deadly Laser |
1721C - Min-Max Array Transformation | 1721A - Image |
1180C - Valeriy and Deque | 557A - Ilya and Diplomas |
1037D - Valid BFS | 1144F - Graph Without Long Directed Paths |
1228A - Distinct Digits | 355B - Vasya and Public Transport |
1230A - Dawid and Bags of Candies | 1530A - Binary Decimal |
1472D - Even-Odd Game | 441C - Valera and Tubes |
1328E - Tree Queries | 265A - Colorful Stones (Simplified Edition) |
296A - Yaroslav and Permutations | 967B - Watering System |
152A - Marks | 1398A - Bad Triangle |
137A - Postcards and photos | 1674D - A-B-C Sort |
334A - Candy Bags | 855A - Tom Riddle's Diary |
1417A - Copy-paste | 1038A - Equality |
1061A - Coins | 1676E - Eating Queries |
1447A - Add Candies | 1721D - Maximum AND |